<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui" template="/templates/general.xhtml">

	<ui:define name="title">
		<h:outputText value="#{msgs['register']}" />
	</ui:define>
	<ui:define name="content">
		<h:form>
			<p:panel id="registerPanel">
				<h:panelGrid columns="2" cellpadding="5">

					<h:outputLabel for="login" value="#{domain['user.login']}" />
					<p:inputText value="#{userBean.user.login}" id="login"
						required="true" />

					<h:outputLabel for="password" value="#{domain['user.password']}" />
					<p:password promptLabel="#{msgs['enterPassword']}" id="password"
						weakLabel="#{msgs['weak']}" goodLabel="#{msgs['good']}"
						strongLabel="#{msgs['strong']}" value="#{userBean.user.password}" />

					<h:outputLabel for="name" value="#{domain['user.name']}" />
					<p:inputText value="#{userBean.user.name}" id="name"
						required="true" />
					<h:outputLabel for="surname" value="#{domain['user.surname']}" />
					<p:inputText value="#{userBean.user.surname}" id="surname"
						required="true" />

					<h:outputLabel for="email" value="#{domain['user.email']}" />
					<p:inputText value="#{userBean.user.email}" id="email" validatorMessage="#{msgs['emailIncorrect']}"
						required="true">
						<f:validateRegex
							pattern="^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$" />
					</p:inputText>

				</h:panelGrid>
			</p:panel>
			<p:commandButton value="#{msgs['save']}" id="register"
				styleClass="float_right" actionListener="#{userBean.doRegister}"
				image="ui-icon ui-icon-disk">
				<f:setPropertyActionListener target="#{loginBean.user}"
					value="#{userBean.user.login}" />
				<f:setPropertyActionListener target="#{loginBean.password}"
					value="#{userBean.user.password}" />
			</p:commandButton>

			<p:commandButton value="#{msgs['back']}" id="back" immediate="true"
				ajax="false" styleClass="float_right" action="#{loginBean.doLogin}"
				image="ui-icon ui-icon-arrowreturnthick-1-w">
			</p:commandButton>
		</h:form>
	</ui:define>
</ui:composition>